home *** CD-ROM | disk | FTP | other *** search
- /xlv1/freeware/1998.May/sh-utils/1.16b/sh-utils-1.16b.diffbuild/man
-
-
-
- EEEEXXXXPPPPRRRR((((1111)))) FFFFSSSSFFFF ((((GGGGNNNNUUUU SSSShhhheeeellllllll UUUUttttiiiilllliiiittttiiiieeeessss)))) EEEEXXXXPPPPRRRR((((1111))))
-
-
-
- NNNNAAAAMMMMEEEE
- expr - evaluate expressions
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- eeeexxxxpppprrrr expression...
- eeeexxxxpppprrrr {--help,--version}
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- This documentation is no longer being maintained and may be
- inaccurate or incomplete. The Texinfo documentation is now
- the authoritative source.
-
- This manual page documents the GNU version of eeeexxxxpppprrrr. eeeexxxxpppprrrr
- evaluates an expression and writes the result on its
- standard output. Each token of the expression must be a
- separate argument. Operands are either numbers or strings.
- Strings are not quoted for eeeexxxxpppprrrr, though you may need to
- quote them to protect them from the shell. eeeexxxxpppprrrr coerces
- anything appearing in an operand position to an integer or a
- string depending on the operation being applied to it.
-
- The operators (in order of increasing precedence) are:
-
- | Yields its first argument if it is neither null nor 0,
- otherwise its second argument. This is the usual `or'
- operation.
-
- & Yields its first argument if neither argument is null
- or 0, otherwise 0.
-
- < <= = == != >= >
- Compare their arguments and return 1 if the relation is
- true, 0 otherwise. (== is a synonym for =.) eeeexxxxpppprrrr
- tries to coerce both arguments to numbers and do a
- numeric comparison; if it fails when trying to coerce
- either argument it then does a lexicographic
- comparison.
-
- + - Perform arithmetic operations. Both arguments are
- coerced to numbers; an error occurs if this cannot be
- done.
-
- * / %
- Perform arithmetic operations (`%' is the remainder
- operation, as in C). Both arguments are coerced to
- numbers; an error occurs if this cannot be done.
-
- : Perform pattern matching. Its arguments are coerced to
- strings and the second one is considered to be a
- regular expression, with a `^' implicitly added at the
- beginning. The first argument is then matched against
- this regular expression. If the match succeeds and
-
-
-
- Page 1 (printed 5/18/98)
-
-
-
-
-
-
- EEEEXXXXPPPPRRRR((((1111)))) FFFFSSSSFFFF ((((GGGGNNNNUUUU SSSShhhheeeellllllll UUUUttttiiiilllliiiittttiiiieeeessss)))) EEEEXXXXPPPPRRRR((((1111))))
-
-
-
- part of the string is enclosed in `\(' and `\)', that
- part is the value of the : expression; otherwise an
- integer whose value is the number of characters matched
- is returned. If the match fails, the : operator
- returns the null string if `\(' and `\)' are used,
- otherwise 0. Only one `\(' and `\)' pair can be used.
-
- In addition, the following keywords are recognized:
-
- mmmmaaaattttcccchhhh _s_t_r_i_n_g _r_e_g_e_x
- An alternative way to do pattern matching. This is the
- same as ``_s_t_r_i_n_g :::: _r_e_g_e_x''.
-
- ssssuuuubbbbssssttttrrrr _s_t_r_i_n_g _p_o_s_i_t_i_o_n _l_e_n_g_t_h
- Return the substring of _s_t_r_i_n_g beginning at _p_o_s_i_t_i_o_n
- with length at most _l_e_n_g_t_h. If either _p_o_s_i_t_i_o_n or
- _l_e_n_g_t_h is negative or non-numeric, return a null
- string.
-
- iiiinnnnddddeeeexxxx _s_t_r_i_n_g _c_h_a_r_a_c_t_e_r-_c_l_a_s_s
- Return the first position in _s_t_r_i_n_g where the first
- character in _c_h_a_r_a_c_t_e_r-_c_l_a_s_s was found. If no
- character in _c_h_a_r_a_c_t_e_r-_c_l_a_s_s is found in _s_t_r_i_n_g, return
- 0.
-
- lllleeeennnnggggtttthhhh _s_t_r_i_n_g
- Return the length of _s_t_r_i_n_g.
-
- Parentheses are used for grouping in the usual manner. The
- keywords cannot be used as strings.
-
- OOOOPPPPTTTTIIIIOOOONNNNSSSS
- When GNU eeeexxxxpppprrrr is invoked with exactly one argument, the
- following options are recognized:
-
- --_h_e_l_p
- Print a usage message on standard output and exit
- successfully.
-
- --_v_e_r_s_i_o_n
- Print version information on standard output then exit
- successfully.
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
- To add 1 to the shell variable _a:
-
- a=`expr $a + 1`
-
- The following may be used to print the non-directory part of
- the file name stored in variable _a (the value in _a need not
- contain `/'):
-
-
-
-
- Page 2 (printed 5/18/98)
-
-
-
-
-
-
- EEEEXXXXPPPPRRRR((((1111)))) FFFFSSSSFFFF ((((GGGGNNNNUUUU SSSShhhheeeellllllll UUUUttttiiiilllliiiittttiiiieeeessss)))) EEEEXXXXPPPPRRRR((((1111))))
-
-
-
- expr $a : '.*/\(.*\)' '|' $a
-
- Note the quoted shell metacharacters.
-
- eeeexxxxpppprrrr returns the following exit status:
-
- 0 if the expression is neither null nor 0,
- 1 if the expression is null or 0,
- 2 for invalid expressions.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 3 (printed 5/18/98)
-
-
-
-